function init()
{
  elements = document.getElementsByTagName( "a" );
  
  for each ( var e in elements )
  {
    if ( e.attributes[ 'rel' ] )
    {
      var icon = document.createElement( "img" );
      icon.setAttribute( "src", "images/linkout.gif" );
      icon.style.paddingLeft = "2px";
      
      var anchor = document.createElement( "a" );
      anchor.appendChild( icon );
      anchor.setAttribute( "target", "_new" );
      anchor.setAttribute( "href", e.getAttribute( "href" ) );
      anchor.style.verticalAlign = "middle";
      
      e.parentNode.appendChild( anchor );
    }
  }
}

window.onload = init
